<template>
  <div class="header wrap">
    <div class="left">
      <img src="../assets/img/indexLogo.6f8ac4f0.png" alt="" />
    </div>
    <div class="center">
      <ul>
        <li :class="$route.path=='/'?'active':''" @click="$router.push('/')">首页</li>
        <li :class="$route.path=='/goods'?'active':''" @click="$router.push('/goods')">全部商品</li>
        <li :class="$route.path=='/user'?'active':''" @click="$router.push('/user')">个人中心</li>
        <li :class="$route.path=='/order'?'active':''" @click="$router.push('/order')">我的订单</li>
        <li :class="$route.path=='/free'?'active':''" @click="$router.push('/free')">专属福利</li>
      </ul>
    </div>
    <div class="right">
      <input type="text"  placeholder="请输入商品" v-model="txt"/>
      <span @click="toSearch"><img src="../assets/img/search.png" alt="" /></span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      txt:""
    };
  },
  methods:{
    toSearch(){
      //跳转携带参数
      this.$router.push(`/goods?keyword=${this.txt}`)
    }
  }
};
</script>

<style lang = "less" scoped>
@import url("../assets/style/global.less");
.header {
  height: 118px;

  display: flex;
  justify-content: space-between;
  align-items: center;
}
.center ul {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 500px;
  
}
.right {
  display: flex;
  input {
    width: 214px;
    height: 38px;
    border: 1px solid #dedede;
    border-radius: 20px 0px 0px 20px;
    padding: 0px;
    outline: none;
    text-indent: 30px;
  }
  span {
    width: 50px;
    height: 40px;
    background: #0a328e;
    border-radius: 0px 20px 20px 0px;
    display: flex;
    justify-content:center;
    align-items: center;
    cursor: pointer;
  }
}
.active{
    color: @basecolor;
    font-weight: 700;
}
</style>